﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Control_SelectCheckBox : System.Web.UI.UserControl
{
	private string strText;
	private GridView dv;
	private string strCheckBoxID;

	public string Text
	{
		get { return strText; }
		set 
		{
			strText = value.Trim();
			BtnMultiSelect.Text = strText;
		}
	}

	public GridView DV
	{
		set
		{
			dv = value;
		}
	}

	public string CheckBoxID
	{
		set
		{
			strCheckBoxID = value.Trim();
		}
	}

	protected void Page_Load(object sender, EventArgs e)
	{
		strText = "全选反选";
		BtnMultiSelect.Text = strText;
	}

	protected void BtnMultiSelect_OnClick(object sender, EventArgs e)
	{
		
		for (int i = 0; i < dv.Rows.Count; i++)
		{
			CheckBox Chk = (CheckBox)dv.Rows[i].FindControl(strCheckBoxID);
			if (Chk.Checked == true)
			{
				Chk.Checked = false;
			}
			else
			{
				Chk.Checked = true;
			}
		}
	}
}
